********************************************************************************
* Balyuk, Berger, and Hackney (2024)                                           *
* "What is Fueling FinTech Lending? The Role of Banking Market Structure"      *
* The Review of Corporate Financial Studies                                    *
********************************************************************************

clear all
clear matrix

******************************   Table X   *************************************

* open file *

	use "$code\DATA_Prosper_annual_county_w.dta", clear

* designate controls *	
	
	global controls_basic="bank_access_l deposits_l log_pop_l ib6.rurality"
	global controls_extended="bank_access_l deposits_l log_pop_l median_income_l unemployment_l house_price_chg_l ib6.rurality"
	global controls_full="bank_access_l deposits_l log_pop_l median_income_l house_price_chg_l eq_capital_ratio_l liquidity2gta_l ROA_l nonperf2loans_l ib6.rurality"	
	
	* change as needed
	global controls="$controls_basic"	
	
* Panel A - large vs small bank lending *

	reghdfe hirn2pop_0_20 Ysb1_P_l large_bank2_P_l small_bank2_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		replace stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_20_50 Ysb1_P_l large_bank2_P_l small_bank2_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_50_250 Ysb1_P_l large_bank2_P_l small_bank2_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
		
	reghdfe hirn2pop_250_500 Ysb1_P_l large_bank2_P_l small_bank2_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)		
	
* Panel B - in-market vs out-of-market bank lending *
	
	reghdfe hirn2pop_0_20 Ysb1_P_l out_100_P_l in_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_20_50 Ysb1_P_l out_100_P_l in_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_50_250 Ysb1_P_l out_100_P_l in_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
		
	reghdfe hirn2pop_250_500 Ysb1_P_l out_100_P_l in_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
* Panel C - separate categories of bank lending *
		
	reghdfe hirn2pop_0_20 Ysb1_P_l out_large2_100_P_l in_large2_100_P_l ///
		out_small2_100_P_l in_small2_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_20_50 Ysb1_P_l out_large2_100_P_l in_large2_100_P_l ///
		out_small2_100_P_l in_small2_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
	
	reghdfe hirn2pop_50_250 Ysb1_P_l out_large2_100_P_l in_large2_100_P_l ///
		out_small2_100_P_l in_small2_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)
		
	reghdfe hirn2pop_250_500 Ysb1_P_l out_large2_100_P_l in_large2_100_P_l ///
		out_small2_100_P_l in_small2_100_P_l $controls , ///
		absorb(fips year) cluster(fips)
	outreg2 using "$code\Table_X.xls", ///
		append stats(coef tstat) tdec(2) auto(2) bfmt(fc)

* NB: Also see Tables IA.25 and IA.26 in Internet Appendix *
